package paneles

import java.util.List
import modelo.Jugador
import modelo.Planta
import org.apache.wicket.markup.html.basic.Label
import org.apache.wicket.markup.html.panel.Panel
import org.uqbar.wicket.xtend.WicketExtensionFactoryMethods
import org.uqbar.wicket.xtend.XListView

class PanelJardinZen extends Panel{
	extension 	WicketExtensionFactoryMethods = new WicketExtensionFactoryMethods
    List<Planta> jardinZen
	
	new(String id, Jugador jugador, List<Planta> jardinZen) {

		super(id)
		this.jardinZen=jardinZen
		this.defaultModel = jugador.asCompoundModel
		this.agregaComponetes(id, jugador)
		var botonera= new Botonera("botonera", jugador, this)
		this.addChild(botonera)
		
	}
	
    def agregaComponetes (String id, Jugador jugador){
    	this.agregarTabla(this.jardinZen)	
    }
	

	def agregarTabla( List<Planta> jardinZen) {
		val listView = new XListView("jardin")
		listView.model = jardinZen.asCompoundModel
		listView.populateItem = [ item |
			item.model = item.modelObject.asCompoundModel
			item.addChild(new Label("nombre"))
			item.addChild(new Label("danio"))
			item.addChild(new Label("resistencia"))
		]
		this.addChild(listView);

	}
	}